<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('c_articles')) {
            Schema::create('c_articles', function (Blueprint $table) {
                $table->increments('id')->comment('ID');
                $table->integer('work_id')->default(0)->comment('医护工作室ID');
                $table->string('article_title', 50)->comment('标题');
                $table->text('content')->comment('内容');
                $table->integer('sales')->comment('销量');
                $table->integer('views')->comment('阅读量');
                $table->integer('likes')->comment('点赞量');
                $table->float('article_score')->comment('好评率');
                $table->decimal('art_price')->comment('价格');
                $table->tinyInteger('isfee')->default(2)->comment('是否收费(2:免费,1:收费)');
                $table->tinyInteger('is_use')->default(0)->comment('是否显示(0:隐藏,1:显示)');
                $table->tinyInteger('status')->default(0)->comment('审核状态(2:未通过,1:已通过)');
                $table->string('art_img', 255)->default("")->nullable()->comment('logo');
                $table->string('author', 50)->default("")->nullable()->comment('作者');
                $table->text('sound')->comment('录音地址');
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('c_articles');
    }
}
